package com.eight.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.eight.annotation.Login;
import com.eight.pojo.SysAdmin;
import com.eight.service.AdminService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 微服务内部接口，编写请按照下面规格编写
 * @Author: Van.Planifolia
 * @CreateTime: 2023-02-23  09:42
 * @Version: 1.0
 */
@RestController
@RequestMapping("/system/admin")
public class AdminController {
    /**
     * 注入Service层
     */
    @Resource(name = "adminService")
    private AdminService adminService;



    /**
     * 根据用户的姓名查询用户信息
     * @param name 用户的账号
     * @return 查询到用户的信息
     */
    @GetMapping("/getByName/{name}")
    public SysAdmin getAdminByName(@PathVariable String name){
        // 这里我们直接调用mybatis中的单条查询
        return adminService.getOne(new QueryWrapper<SysAdmin>().eq("admin_username", name));
    }

}
